package com.taoye.thread;

public class Demo07 {
	public static void main(String[] args) throws InterruptedException {
		Demo07Thread t = new Demo07Thread();
		t.start();
		Thread.sleep(2);//睡眠2毫秒
		t.stopThread();
	}
}

class Demo07Thread extends Thread {
	
	private boolean flg = true;

	@Override
	public void run() {
		while (flg) {
			System.out.println("当前时间："+System.currentTimeMillis());
		}
		System.out.println("线程执行结束了");
	}
	
	public void stopThread() {
		flg = false;
	}
}